<?php
/**
 * Created by PhpStorm.
 * User: happy
 * Date: 19/4/19
 * Time: 下午9:55
 * coroutine 示例 ,从ppt上获取
 */

$socket=stream_socket_server('tcp://0.0.0.0:8089',$error_nu,$error_str);
while($conn=stream_socket_accept($socket)){
    if(pcntl_fork()==0){
        $request=fread($conn,2048);
        fwrite($conn,"hello demo");
        fclose($conn);
        exit;

    }

}